package 力扣._300最长递增子序列;

import java.util.Arrays;

public class Solution {
    public int lengthOfLIS(int[] nums) {
        //dp[i]: 以nums[i]为结尾的最长递增子序列大小
        int[] dp = new int[nums.length];
        dp[0] = 1;
        for (int i = 1; i < nums.length; i++) {
            dp[i] = 1;
            for (int j = 0; j < i; j++) {
                if (nums[i] > nums[j]) {
                    dp[i] = Math.max(dp[j] + 1,dp[i]);
                }
            }
        }
//        System.out.println(Arrays.toString(dp));
        int max = 0;
        for (int d : dp) {
            max = Math.max(d, max);
        }
        return max;
    }

    public static void main(String[] args) {
        int[] nums = new int[]{0, 1, 0, 3, 2, 3};
        int i = new Solution().lengthOfLIS(nums);
    }
}
